import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const login = r => require.ensure([], () => r(require('@/page/login')), 'login');
const manage = r => require.ensure([], () => r(require('@/page/manage')), 'manage');
// const home = r => require.ensure([], () => r(require('@/page/home')), 'home');
const addShop = r => require.ensure([], () => r(require('@/page/addShop')), 'addShop');
const setTest = r => require.ensure([], () => r(require('@/page/setTest')), 'setTest');
const addGoods = r => require.ensure([], () => r(require('@/page/addGoods')), 'addGoods');
const userList = r => require.ensure([], () => r(require('@/page/userList')), 'userList');
const shopList = r => require.ensure([], () => r(require('@/page/shopList')), 'shopList');
const foodList = r => require.ensure([], () => r(require('@/page/foodList')), 'foodList');

const newMember = r => require.ensure([], () => r(require('@/page/newMember')), 'newMember');

const adminSet = r => require.ensure([], () => r(require('@/page/adminSet')), 'adminSet');
const explain = r => require.ensure([], () => r(require('@/page/explain')), 'explain');
const signDetail = r => require.ensure([], () => r(require('@/page/signDetail')), 'signDetail');

// const setTest = r => require.ensure([], () => r(require('@page/setTest')), 'setTest');
const routes = [
	{
		path: '/',
		component: login
	},
	{
		path: '/manage',
		component: manage,
		name: '',
		children: [
		// 	{
		// 	path: '',
		// 	// component: home,
		// 	meta: [],
		// }, 
		// {
		// 	path: '/addShop',
		// 	component: addShop,
		// 	meta: ['任务布置', '作业发布'],
		// }, 
		{
			path: '/addGoods',
			component: addGoods,
			meta: ['任务布置', '试卷题发布'],
		},
		{
			path: '/setTest',
			component: setTest,
			meta: ['任务布置', '试卷发布'],
		},
		{
			path: '/userList',
			component: userList,
			meta: ['数据管理', '用户列表'],
		}, 
		{
			path: '/shopList',
			component: shopList,
			meta: ['数据管理', '学生成绩'],
		}, {
			path: '/foodList',
			component: foodList,
			meta: ['数据管理', '签到列表'],
		}, {
			path: '/signDetail',
			component: signDetail,
			meta: ['数据管理', '签到详情'],
		}, {
			path: '/newMember',
			component: newMember,
			meta: ['任务布置', '课表设置'],
		},  {
			path: '/adminSet',
			component: adminSet,
			meta: ['设置', '管理员设置'],
		}, 
		{
			path: '/explain',
			component: explain,
			meta: ['说明', '说明'],
		}]
	}
]

export default new Router({
	routes,
	strict: process.env.NODE_ENV !== 'production',
})
